// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Mvc;
using NSQL.Parser;

namespace NSQL.Server.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TranslateController : ControllerBase
    {
        [HttpPost(nameof(ToSql))]
        public string ToSql([FromBody] string sql)
        {
            return SqlParser.TranslateToSql(sql);
        }
        
        [HttpPost(nameof(ToNpgsql))]
        public string ToNpgsql([FromBody] string sql)
        {
            return SqlParser.TranslateToNpgsql(sql);
        }

        [HttpPost(nameof(ToOracle))]
        public string ToOracle([FromBody] string sql)
        {
            return SqlParser.TranslateToOracle(sql);
        }


        [HttpPost(nameof(ToMySQL))]
        public string ToMySQL([FromBody] string sql)
        {
            return SqlParser.TranslateToMySql(sql);
        }

        [HttpPost(nameof(ToSqlServer))]
        public string ToSqlServer([FromBody] string sql)
        {
            return SqlParser.TranslateToSqlServer(sql);
        }


        [HttpPost(nameof(ToSQLite))]
        public string ToSQLite([FromBody] string sql)
        {
            return SqlParser.TranslateToSQLite(sql);
        }
    }
}